<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/locale/easyui-lang-zh_CN.js"></script>
<link href="<%=request.getContextPath()%>/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/easyui/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/jPages.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/animate.css">
<script src="<%=request.getContextPath()%>/js/jquery-1.8.2.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jPages.js"></script>
<style>
	.yes{
		width: 96px;
	    height: 35px;
	    line-height: 35px;
	    color: #fff;
 	  	background: url(/htx-backer/images/btnbg1.png) repeat-x;
	    font-size: 14px;
	    font-weight: bold;
	    border-radius: 3px;
	    cursor: pointer;
    }
</style>
<script type="text/javascript">
$(function(){  
	$("div.holder").jPages({  
	  containerID : "item", 
	  first:"首页", 
	  previous : "上一页",  
	  next : "下一页",
	  last:"尾页",  
	  perPage : 10,  
	  //delay : 100,
	  //动画效果
	  //animation:"bounceInLeft"
	});  
 });  
</script>
<script type="text/javascript">
$(document).ready(function(){
  $(".click").click(function(){
 	 $(".tip").fadeIn(200);
  });
  
  $(".sure").click(function(){
 	 $(".tip").fadeOut(100);
  });

  $(".cancel").click(function(){
	  $(".tip").fadeOut(100);
	  $(".butongguo").fadeOut(100);
	  $(".account").fadeOut(100);
  });
});
</script>
</head>

<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><ema href="javascript:void">首页</em></li>
			<li><ema href="javascript:void">财务管理</em></li>
			<li><ema href="javascript:void">提现审核</em></li>
		</ul>
	</div>
	<div class="rightinfo">
		<div class="tools">
			<form action="<%=request.getContextPath()%>/selectWithdrawList" method="post" name="serch">
				<td class="zi">提交时间：</td>
				<td><input type="date" name="startTime" style="border:1px solid #d7a372;"/>至<input type="date" name="endTime" style="border:1px solid #d7a372;"/></td>
			<td class="zi">手机号：</td>
				<td><input type="input" name="mobile" style="border:1px solid #d7a372;"/></td>
			<td class="zi">城市：</td>
				<td><input type="input" name="address" style="border:1px solid #d7a372;"/></td>
			<td class="zi">提现类型：</td>
				<td><select name="type">
								<option selected="selected" value="">请选择</option>
								<option value="2">支付宝</option>
								<option value="1">银行卡</option>
						</select></td>

			<div class="toolbar1">
				<table>
					<tr>
						
						<td class="zi"><span>选择审核状态：</span></td>
						<td><select name="state">
								<option selected="selected" >请选择分类</option>
								<option>待审核</option>
								<option>审核通过</option>
								<option>审核不通过</option>
								<option>提现完成</option>
						</select></td>
						<!-- <td class="zi" ><span >模糊搜索：</span></td>
						<td><input type="text" placeholder="请输入企业昵称" name="username"/></td> -->
						<td><input type="submit" value="查询" class="button" /></td>
					</tr>
				</table>
			</div>
			<div class="tools">
			<ul class="toolbar">
				<li class="exportExcel"><span><img src="<%=request.getContextPath()%>/images/t04.png" /></span>导出</li>
				<li onclick="batch()">&nbsp;&nbsp;批量审核</li>
			</ul>
		</div>
			</form>
		</div>
		<table class="tablelist">
			<thead>
				<tr>
					<th><input type="checkbox" value="" id="selectAll" /></th>
					<th>姓名</th>
					<th>手机号</th>
					<th>真实姓名</th>
					<th>提现单号</th>
					<th>提现金额</th>
					<th>提现类型</th>
					<th>提现账号</th>
					<th>银行类型</th>
					<th>提交时间</th>
					<th>审核状态</th>
					<th>审核人</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody class="tb" id="item">
				<c:forEach items="${lists}" var="data">
					<tr>
					<td><input name="select" type="checkbox" value="${data.id}" /></td>
						<td>${data.username}</td>
						<td>${data.mobile}</td>
 						<td>${data.real_name}</td>
 						<td>${data.id}</td>
						<td>${data.money}</td>
						<td>
							<c:if test="${data.type == 1}">银行卡提现</c:if>
							<c:if test="${data.type == 2}">支付宝提现</c:if>
						</td>
						<td>${data.bank_card}</td>
						<td>${data.bank_name}</td>
						<td>${data.create_time}</td>
						<td>${data.state}</td>
						<td>${data.name}</td>
						<td>
							<a href="/htx-backer/selectWithdrawList?id=${data.id}" style="cursor:pointer;color:blue;font-size:14px;font-weight:bold;">查看</a>
							<c:if test="${data.state == '待审核'}">
								&nbsp;&nbsp;&nbsp;
								<strong onclick="update(this)" style="cursor:pointer;color:blue;font-size:14px">审核通过</strong>
	                         	&nbsp;&nbsp;&nbsp;
								<strong onclick="update(this)" style="cursor:pointer;color:blue;font-size:14px">审核不通过</strong>
							</c:if>
							<c:if test="${data.state == '审核通过'}">
								&nbsp;&nbsp;&nbsp;
								<strong onclick="account(this)" style="cursor:pointer;color:blue;font-size:14px">提现到账</strong>
							</c:if>
						</td>
						<input name="wid" type="hidden" value="${data.id}"/>
						<input name="userid" type="hidden" value="${data.user_id}"/>
						<input name="username" type="hidden" value="${data.username}"/>
						<input name="money" type="hidden" value="${data.money}"/>
						<input name="orderId" type="hidden" value="${data.order_id}"/>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div style="clear:both;"></div>
		<!-- 分页的页码 -->
		<div class="holder"></div>
		共${nums}条记录
		<div class="tip">
			<div class="tiptop">
				<span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认审核通过 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="sure" value="确定"/>&nbsp;<input name="" type="button" class="cancel" value="取消" />
			</div>
		</div>
		
		<div class="butongguo" style="width:485px; height:260px; position:absolute;top:10%; left:30%;background:#fcfdfd;box-shadow:1px 8px 10px 1px #9b9b9b;border-radius:1px;behavior:url(js/pie.htc); display:none; z-index:111111;">
			<div class="tiptop">
				<span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认审核不通过 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="sure" value="确定"/>&nbsp;<input name="" type="button" class="cancel" value="取消" />
			</div>
		</div>
		
		<div class="account" style="width:485px; height:260px; position:absolute;top:10%; left:30%;background:#fcfdfd;box-shadow:1px 8px 10px 1px #9b9b9b;border-radius:1px;behavior:url(js/pie.htc); display:none; z-index:111111;">
			<div class="tiptop">
				<span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认到账？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="yes" value="确定"/>&nbsp;<input name="" type="button" class="cancel" value="取消" />
			</div>
		</div>
		<div class="shenhe" style="width:485px; height:260px; position:absolute;top:10%; left:30%;background:#fcfdfd;box-shadow:1px 8px 10px 1px #9b9b9b;border-radius:1px;behavior:url(js/pie.htc); display:none; z-index:111111;">
			<div class="tiptop">
				<span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认批量审核 ？</p>
					<cite>如果是请点击通过 ，或者不通过。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button"  onclick="yes()" class="sure"  value="通过"/>&nbsp; <input name="" type="button"  onclick="no()" class="sure"  value="不通过"/>&nbsp; <input name="" type="button" class="cancel" onclick="guan()"  value="取消" />
			<input type="hidden" id="sel"  />
			</div>
		</div>
	</div>
	<script type="text/javascript">
		$('.tablelist tbody tr:odd').addClass('odd');

		  function update(a){
			  var states = $(a).text();
			  if(states == "审核通过"){
				  $(".tip").fadeIn(500);
			  }else if(states == "审核不通过"){
				  $(".butongguo").fadeIn(500);
			  }
			  $(".sure").click(function(){
		      	 var id = $(a).parent().parent().find("input[name=wid]").val();
		      	 var userid = $(a).parent().parent().find("input[name=userid]").val();
		      	 var username = $(a).parent().parent().find("input[name=username]").val();
		      	 var money = $(a).parent().parent().find("input[name=money]").val();
		      	 var orderId = $(a).parent().parent().find("input[name=orderId]").val();
		      	 window.location.href="<%=request.getContextPath()%>/updateWithdrawStatus?idd="+id+"&states="+states+"&userid="+userid+"&username="+username+"&money="+money+"&orderId="+orderId;
		      });
		  }
		  
		  function account(a){
			  var states = $(a).text();
			  $(".account").fadeIn(500);
			  $(".yes").click(function(){
		      	 var id = $(a).parent().parent().find("input[name=wid]").val();
		      	 var userid = $(a).parent().parent().find("input[name=userid]").val();
		      	 var username = $(a).parent().parent().find("input[name=username]").val();
		      	 var money = $(a).parent().parent().find("input[name=money]").val();
		      	 window.location.href="<%=request.getContextPath()%>/updateWithdrawStatus?idd="+id+"&states="+states+"&userid="+userid+"&username="+username+"&money="+money;
		      });
		  }
		  
		 $(".exportExcel").click(function(){
				 window.location.href = "/htx-backer/withdrawExportExcel?startTime="+ $("input[name=startTime]").val()+"&endTime="+$("input[name=endTime]").val()+"&username="+$("input[name=username]").val()+"&grade="+$("select[name='grade']").val()+"&age="+$("input[name=age]").val()+"&mobile="+$("input[name=mobile]").val()+"&isEnprise="+$("select[name='isEnprise']").val()+"&isUser="+$("select[name='isUser']").val();
		  })
		  function guan(){
			  $(".shenhe").hide();
		  }
		  function batch(){
			  $(".shenhe").fadeIn(500);
		  }
		 	$("#selectAll").click(function() {
				if($("#selectAll").is(":checked")){
					$("input[name=select]").prop("checked","checked");
				}else{
					$("input[name=select]").attr("checked",false);
				}
			});
		  function no(){
			  var sd = [];
			  var se = $("input[name=select]:checked");
			  if(se.length>0){
				  for (var i = 0; i < se.length; i++) {
					  var id =$(se[i]).parent().parent().find("input[name=wid]").val();
					  if(id==se[i].value){
						  $.ajax({
				  				type:"POST",
				  				url:"<%=request.getContextPath()%>/batchWithdrawStatus", 
				  				data:{
				  					userid:$(se[i]).parent().parent().find("input[name=userid]").val(),
				  					username:$(se[i]).parent().parent().find("input[name=username]").val(),
				  					money:$(se[i]).parent().parent().find("input[name=money]").val(),
				  					idd:id,
				  					states:'审核不通过',
				  				},
				  				dataType:"json",
				  				success:function(data){
				  					if(data.flag > 0){
				  						if(i==se.length){
				  							var btn= confirm("审核成功!")
				  							if(btn == true){
				  			   					window.location.href="<%=request.getContextPath()%>/selectWithdrawList";
				  	  					 	}
				  						}
				  						
				  					}else{
				  						if(i==se.length){
				  							 alert("审核失败!")
				  						}
				  					}
				  				}
							})
					  }
				}
			  }
			  
			
		  }
 	function yes(){
 		var sd = [];
		  var se = $("input[name=select]:checked");
		  if(se.length>0){
		  for (var i = 0; i < se.length; i++) {
			  var id =$(se[i]).parent().parent().find("input[name=wid]").val();
			  if(id==se[i].value){
					$.ajax({
		  				type:"POST",
		  				url:"<%=request.getContextPath()%>/batchWithdrawStatus", 
		  				data:{
		  					userid:$(se[i]).parent().parent().find("input[name=userid]").val(),
		  					username:$(se[i]).parent().parent().find("input[name=username]").val(),
		  					money:$(se[i]).parent().parent().find("input[name=money]").val(),
		  					idd:id,
		  					states:'审核通过',
		  				},
		  				dataType:"json",
		  				success:function(data){
		  					if(data.flag > 0){
		  						if(i==se.length){
		  							var btn= confirm("审核成功!")
		  							if(btn == true){
		  			   					window.location.href="<%=request.getContextPath()%>/selectWithdrawList";
		  	  					 	}
		  						}
		  						
		  					}else{
		  						if(i==se.length){
		  							 alert("审核失败!")
		  						}
		  					}
		  				}
					}) 
			  }
		}
			}
		  }
 	
 	
	</script>
	
</body>
</html>
